<template>
  <basic-container >
    <el-page-header @back="goBack" >
      <template slot="content">
        <span>{{station.chargeStationName}}</span>
      </template>
    </el-page-header>
    <el-tabs v-model="activeName" @tab-click="handleClick" >
      <el-tab-pane label="场站信息" name="first">
        <detail :station="station"></detail>
      </el-tab-pane>
      <el-tab-pane label="电价区间" name="second">
        <price ref="realData" :station="station"></price>
      </el-tab-pane>
    </el-tabs>
  </basic-container>
</template>

<script>
  import { getStation } from "@/api/smart/operator/station";
  import detail from "@/views/smart/operator/station/detail";
  import price from "@/views/smart/operator/station/price";
  export default {
  name: "viewStationInfo",
  components:{detail,price},
  data(){
    return{
      activeName:'first',
      chargeStationId:null,
      station: {},
    }
  },
  created() {
    this.$nextTick(() =>{
      this.chargeStationId = this.$route.query.chargeStationId;
      this.getStationDetail();
    })
  },
  methods:{
    getStationDetail(){
      getStation(this.chargeStationId).then(response => {
        this.station = response.data;
        this.station.nationalStandardInterface = this.station.nationalStandardInterface.split(",");
        this.station.auxiliarySourceVoltage = this.station.auxiliarySourceVoltage.split(",");
        this.station.gunType = this.station.gunType.split(",");
        this.station.paymentMethod = this.station.paymentMethod.split(",");
        this.station.paymentChannels = this.station.paymentChannels.split(",");
        this.station.chargeStationFacilities = this.station.chargeStationFacilities.split(",");
      });
    },
    goBack(){
      this.$router.go(-1)
    },
    handleClick(){
      if(this.activeName==='first'){
        //this.$refs.historyData.getList();
      }
      if(this.activeName==='second'){
      }
    }
  }
}
</script>
